package com.trust.pams.consumer.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.alibaba.dubbo.config.annotation.Reference;
import com.chasonx.common.model.RpcResult;
import com.chasonx.common.util.Ret;
import com.trust.smart.uuc.model.query.UserQuery;
import com.trust.smart.uuc.service.provider.IMenuProvider;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@Controller
@RequestMapping("/pams/menu")
@Api(value = "menu")
public class IMenuController {

	 @Reference(timeout = 60000 )
	 IMenuProvider imenuProvider;
	 
	 @ApiOperation(value = "查询相关菜单", notes = "8")
	 @RequestMapping(value = "getAssignedMenu", method = RequestMethod.POST)
	 @ApiImplicitParams({
	        @ApiImplicitParam(name = "userType", value = "用户类型", paramType = "form", dataType = "Integer", required = true),
	        @ApiImplicitParam(name = "userGuid", value = "用户id", paramType = "form", dataType = "String", required = true),
	        @ApiImplicitParam(name = "roleGuid", value = "角色id", paramType = "form", dataType = "String", required = true),
	        @ApiImplicitParam(name = "roleType", value = "角色类型", paramType = "form", dataType = "Integer", required = true)
	    })
	 public Ret getAssignedMenu(Integer userType,String userGuid,String roleGuid,Integer roleType) {
	     Ret ret = Ret.get();
		 UserQuery query = new UserQuery();
		 query.setUserType(userType);
		 query.setUserGuid(userGuid);
		 query.setRoleGuid(roleGuid);
		 query.setRoleType(roleType);
		 RpcResult rp=  imenuProvider.getAssignedMenu(query);
		 return ret.setData(rp.getData());
	 }

}
